<template>
 <footer class="footer">
      <span class="todo-count"><strong>{{leaveList}}</strong>剩余</span>
      <ul class="filters">
        <li>
          <a :class="{selected: type ==='all' }" href="#/" @click="changeType('all')">全部</a>
        </li>
        <li>
          <a :class="{selected: type ==='active' }" href="#/active" @click="changeType('active')">进行中</a>
        </li>
        <li>
          <a :class="{selected: type ==='completed' }" href="#/completed" @click="changeType('completed')">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" @click="clearDoneList" v-show="isDoneList">清除已完成</button>
    </footer>
</template>

<script>
 export default {
   name: 'TodoFooter',
   props: {
    // 接收剩余功能数据 
    leaveList:{
      type:Number,
      required:true
    },
    // 是否显示已完成按钮
    isDoneList:{
      type:Boolean,
      required:true
    },
    type:{
      type:String,
      required:true
    }
   },
   methods:{
    // 清除已完成功能 
    clearDoneList(){
      this.$emit('clearDoneList')
    },
    // 改变状态类型事件
    changeType(type){
      this.$emit('changeType',type)
    }

   }

 }
</script>

<style scoped lang='less'>

</style>